#ifndef __PA_HX__H__
#define __PA_HX__H__

#include <stdint.h>
#include "pacmn.h"

#ifdef __cplusplus
extern "C"{
#endif

//#define HX_LTE_LPA                               1
#define HX_GSM_LNA_SKIP                          1

#define HX_RSP_FLAG_OK                           0x3030
//#define HX_RSP_FLAG_ERR_CRC                      0x01
#define HX_RSP_FLAG_ERR_CMD_NUM                  0x02
#define HX_RSP_FLAG_ERR_CMD_DATA                 0x03
#define HX_RSP_FLAG_ERR_PROC                     0x04

#define HX_MSG_RSP_HEAD_FLAG                     0X3E
#define HX_MSG_TAIL_FLAG                         0x0D0A

#define HX_MOD_ADDR_FUNC_PA                      0x30
#define HX_FDD_ADDR_FUNC_PA                      0x31

#define HX_MOD_SEARCH                            0x31    
#define HX_MOD_SET                               0x33
#define HX_MOD_RSP                               0x30







#if 0
#define HX_CMD_TEXT_WRITE/REWD_ALC               0X36
#define HX_CMD_TEXT_SET_ATT_ADJUST_POINT         0X42
#define HX_CMD_TEXT_READ_ATT_ADJUST_POINT        0X43
#endif
//#define HX_CMD_SET_SWITCH_RF                     0x32


//#define HX_SWITCH_RF_OPEN                        0x00
//#define HX_SWITCH_RF_LNA_OPEN                    0x01
//#define HX_SWITCH_RF_PA_OPEN                     0x02
//#define HX_SWITCH_RF_CLOSE                       0x03

//#define HX_CMD_OFFSET_HEAD_FLAG                  0x00
//#define HX_CMD_OFFSET_MOD_ADDR_FUNC              0x01
//#define HX_CMD_OFFSET_MOD_ADDR_CODE              0x02


#define HX_CMD_OFFSET_MOD_ADDR                   0x01
#define HX_CMD_OFFSET_CMD_CODE                   0x03
#define HX_CMD_OFFSET_RSP_FLAG                   0x01
#define HX_CMD_OFFSET_CMD_SIZE                   0x05


//#define HX_LPA_POWER_OFF                         0x0
//#define HX_LPA_POWER_ON                          0x1


#define HX_CMD_OFFSET_CMD_DATA                   0x0A
#define HX_CMD_RSP_DATA                          0x04

#if 0
typedef struct tag_hx_lna_status {
    uint8_t state;
    int8_t att;
    int8_t power;
    int8_t alc;
} hx_lna_status;
#endif

typedef struct tag_hx_pa_status {
	uint8_t on_off;
    int8_t temp;
    uint8_t upatt;
    uint8_t dnatt;
    int8_t dnpower;
    int16_t dn10power;
    uint8_t state;
    uint8_t sw10ratio;
	uint8_t tempthreshold;
	uint8_t powerthreshold;
} hx_pa_status;


pa_ret_t hx_set_pa_switch(int32_t com_fd, mod_addr_t *pa_addr, int8_t on_off);
pa_ret_t hx_set_up_att(int32_t com_fd, mod_addr_t *pa_addr, int8_t up_att);
pa_ret_t hx_set_dn_att(int32_t com_fd, mod_addr_t *pa_addr, int8_t dn_att);
pa_ret_t hx_set_mod_reset(int32_t com_fd, mod_addr_t *pa_addr);

pa_ret_t hx_get_pa_switch(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_get_pa_temp(int32_t com_fd, mod_addr_t * pa_addr, hx_pa_status *status);

pa_ret_t hx_get_up_att(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_get_dn_att(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_get_dn_power(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_get_pa_state(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_get_dn_10_power(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_get_pa_10_swr(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);


pa_ret_t hx_get_pa_status(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_get_pa_temp_threshold(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_set_pa_temp_threshold(int32_t com_fd, mod_addr_t *pa_addr, int8_t temp);
pa_ret_t hx_get_pa_power_threshold(int32_t com_fd, mod_addr_t *pa_addr, hx_pa_status *status);
pa_ret_t hx_set_pa_power_threshold(int32_t com_fd, mod_addr_t *pa_addr, int8_t power);


#ifdef __cplusplus
}
#endif

#endif //__PA_HX__H__

